package com.rbac.api.mybatis.sqlProvider;


import com.rbac.api.mybatis.entity.AdminActionLogsEntity;
import org.apache.ibatis.jdbc.SQL;

public class AdminActionLogsSqlProvider {


    ///写入操作记录
    public String insertActionLogsSelective(AdminActionLogsEntity record) {
        ///基础SQL
        SQL sql = new SQL();
        sql.INSERT_INTO("admin_action_logs");

        ///操作类型
        if (record.getActionType() != null) {
            sql.VALUES("action_type", "#{actionType,jdbcType=VARCHAR}");
        }

        if (record.getActionPosition() != null) {
            sql.VALUES("action_position", "#{actionPosition,jdbcType=VARCHAR}");
        }
        ///操作人编号
        if (record.getActionUserno() != null) {
            sql.VALUES("action_userno", "#{actionUserno,jdbcType=VARCHAR}");
        }
        ///操作人客户端ip
        if (record.getActionClientip() != null) {
            sql.VALUES("action_clientip", "#{actionClientip,jdbcType=VARCHAR}");
        }
        ///操作时间
        if (record.getActionTime() != null) {
            sql.VALUES("action_time", "#{actionTime,jdbcType=TIMESTAMP}");
        }
        ///操作内容（记录的是执行SQL或操作的内容）
        if (record.getActionContent() != null) {
            sql.VALUES("action_content", "#{actionContent,jdbcType=LONGVARCHAR}");
        }

        return sql.toString();
    }





}